package org.training.person.mason.client.common;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PasswordTextBox;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.TextBox;

public class LoginPanel extends PopupPanel {
	
	public LoginPanel(final ClickHandler handler) {
		super(true);

		AbsolutePanel absolutePanel = new AbsolutePanel();
		setWidget(absolutePanel);
		absolutePanel.setSize("241px", "163px");
		
		Label LoginPanelTitle = new Label("\u6B22\u8FCE\u767B\u5F55\u4F7F\u7528\u672C\u7CFB\u7EDF\uFF01");
		LoginPanelTitle.setDirectionEstimator(true);
		absolutePanel.add(LoginPanelTitle, 10, 10);
		LoginPanelTitle.setSize("222px", "41px");
		
		Label LoginPanelUNContent = new Label("\u7528\u6237\u540D\uFF1A");
		absolutePanel.add(LoginPanelUNContent, 10, 63);
		
		final TextBox LoginTextBoxUserName = new TextBox();
		absolutePanel.add(LoginTextBoxUserName, 72, 57);
		
		Label LoginPanelPWContent = new Label("\u5BC6  \u7801\uFF1A");
		absolutePanel.add(LoginPanelPWContent, 10, 102);
		LoginPanelPWContent.setSize("52px", "18px");
		
		final PasswordTextBox LoginTextBoxPassword = new PasswordTextBox();
		absolutePanel.add(LoginTextBoxPassword, 72, 93);
		
		Button LoginButtonReset = new Button("New button");
		LoginButtonReset.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				LoginTextBoxUserName.setText("");
				LoginTextBoxPassword.setText("");
			}
		});
		LoginButtonReset.setText("\u91CD\u7F6E");
		absolutePanel.add(LoginButtonReset, 25, 130);
		LoginButtonReset.setSize("82px", "23px");
		
		Button LoginButtonSubmit = new Button("New button");
		LoginButtonSubmit.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				handler.onClick(event);
			}
		});
		LoginButtonSubmit.setText("\u63D0\u4EA4");
		absolutePanel.add(LoginButtonSubmit, 132, 130);
		LoginButtonSubmit.setSize("82px", "23px");
	}
}
